package myJlite.dao;

import java.sql.SQLException;

import jvlite.dao.JliteORM.BeanHandler;
import jvlite.dao.JliteORM.JliteJdbcSupport;
import jvlite.mvc.annotaion.Part;
import jvlite.util.StrUtil;
import myJlite.entity.RoleVO;
import myJlite.entity.StaffVO;
@Part
public class AuthDAO extends JliteJdbcSupport implements IAuthDAO {
	public RoleVO readAuth(StaffVO staffVO) throws SQLException{
		StringBuilder sql = new StringBuilder("SELECT r.role_auths FROM staff st, roles r WHERE st.role_id=r.role_id");
		if (StrUtil.objNotEmpty(staffVO)&& StrUtil.objNotEmpty(staffVO.getSt_id())) {
			sql.append(" and st_id="+staffVO.getSt_id().toString());
		}
/*		if (!StrUtil.isBlank(examVO.getUsername())) {
			sql.append(" and username like '%"+examVO.getUsername()+"%'");
		}
		if (examVO.getMarks()!=null) {
			sql.append(" and marks="+examVO.getMarks().toString());
		}*/
		return (RoleVO)queryBySQL(sql.toString(), new BeanHandler(RoleVO.class));
	}
}
